﻿
    using System;
    using System.IO;
namespace WCYCReader.Utility
{
    public class BinarySerializationHelper
    {
        public static object Deserialize(Stream streamObject, Type serializedObjectType)
        {
            if ((serializedObjectType == null) || (streamObject == null))
            {
                return null;
            }
            CustomBinarySerializer serializer = new CustomBinarySerializer(serializedObjectType);
            return serializer.ReadObject(streamObject);
        }

        public static void Serialize(Stream streamObject, object objForSerialization)
        {
            if ((objForSerialization != null) && (streamObject != null))
            {
                new CustomBinarySerializer(objForSerialization.GetType()).WriteObject(streamObject, objForSerialization);
            }
        }
    }
}

